package com.yy.controller.mapper;

import com.yy.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    /**
     * 根据手机号查用户
     *
     * @param user
     * @return
     */
    @Select("select * from user where phone = #{phone}")
    User getByPhone(User user);

    /**
     * 修改密码
     *
     * @param user
     */
    @Update("update user set password = #{password} where id = #{id}")
    void update(User user);

    /**
     * 注册账号
     *
     * @param user
     */
    @Insert("insert into user  (name,phone,password,create_time) " +
            "values  (#{name},#{phone},#{password},#{createTime})")
    void add(User user);
}
